<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:83:"D:\fangcms\fangcms_city_add\public/../application/manage\view\poster_space\add.html";i:1490780264;}*/ ?>
<!--添加广告位-->
<div class="dialog_content">
<form id="info_form" action="<?php echo url('PosterSpace/addDo'); ?>" method="post">
<table width="100%" cellpadding="2" cellspacing="1" class="table_form">

	<tr> 
		<th width="80">广告位名称 :</th>
		<td><input type="text" name="name" id="name" class="input-text" size="30"></td>
	</tr>
	<tr>
		<th>广告位类型 :</th>
		<td>
			<select name="type" id="type" onchange="setAttr(this.value);">
			<?php if(is_array($type_list) || $type_list instanceof \think\Collection || $type_list instanceof \think\Paginator): $i = 0; $__LIST__ = $type_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
			<option value="<?php echo $key; ?>"><?php echo $vo; ?></option>
			<?php endforeach; endif; else: echo "" ;endif; ?>
			</select>
		</td>
	</tr>
	<tr id="fixpos" style="display:none;">
		<th>广告位位置 :</th>
		<td>
			左边距 : <input type="text" id="paddleft" name="setting[paddleft]" class="input-text" size="4"> px
			上边距 : <input type="text" id="paddtop" name="setting[paddtop]" class="input-text" size="4"> px
		</td>
	</tr>
	<tr id="size">
		<th>广告位尺寸 :</th>
		<td>宽 : <input type="text" name="width" id="width" class="input-text" size="7" value="300"> px&nbsp;&nbsp;&nbsp;&nbsp;高 : <input type="text" name="height" id="height" class="input-text" size="7" value="300"> px</td>
		</tr>
	<tr> 
		<th>广告位说明 :</th>
		<td><textarea rows="4" cols="45" class="input-textarea" id="description" name="description"></textarea></td>
	</tr>
	<tr>
		<th>状态 :</th>
		<td>
			<label><input type="radio" name="status" value="1" checked> 启用</label>&nbsp;&nbsp;
			<label><input type="radio" name="status" value="0"> 禁用</label>
		</td>
	</tr>
</table>
</form>
</div>
<script type="text/javascript">
var check_name_url = "<?php echo url('PosterSpace/ajaxCheckName'); ?>";
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$("#name").formValidator({onshow:'请填写广告位名称',onfocus:'请填写广告位名称'}).inputValidator({min:1,onerror:'请填写广告位名称'}).ajaxValidator({
	    type : "get",
		url : check_name_url,
		datatype : "json",
		async:'false',
		success : function(result){
            if(result.status == 0){
                return false;
			}else{
                return true;
			}
		},
		buttons: $("#dosubmit"),
		onerror : '广告位已存在',
		onwait : '查询中，请稍候...'
	});

	$('#info_form').ajaxForm({success:complate,dataType:'json'});
	function complate(result){
		if(result.status == 1){
			$.dialog.get(result.dialog).close();
			$.yingloujie.tip({content:result.msg});
			setTimeout(function(){window.location.reload();},1000);
		} else {
			$.yingloujie.tip({content:result.msg, icon:'alert'});
		}
	}
});
	function setAttr(val){
		switch(val){
			case 'couplet':
				$("#fixpos,#size").show();
				break;
			case 'text':
			case 'code':
				$("#fixpos,#size").hide();
				break;
			default :
				$("#fixpos").hide();
				$("#size").show();
				break;
		}
	}
</script>